<?php
declare (strict_types = 1);

namespace app\api\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Info extends Model
{
    protected $pk = 'info_id';

   private function getLangId(){
        return getLangs(session("lang", 'zh_CN'));
   }

    public function description()
    {
        return $this->hasOne("info_description", 'info_id', "info_id")->where("language_id",$this->getLangId())->bind(['title','content','seo','brief']);
    }

    public function infoCats(){
    	return $this->hasMany("info_cat","info_id","info_id");
    }
 

    public function cats(){
        return $this->hasManyThrough(CatDescription::class, InfoCat::class,'info_id','cat_id','info_id','cat_id');
   
    }


    
}
